package com.czy.owner.api;

import com.czy.owner.db.UserHelper;
import com.czy.owner.global.Constants;
import com.czy.owner.net.api.BaseApi;
import com.czy.owner.net.listener.HttpOnNextListener;
import com.trello.rxlifecycle.components.support.RxAppCompatActivity;

import retrofit2.Retrofit;
import rx.Observable;

/**
 * Created by hedepu on 2017/11/1.
 */

public class OwneiInsDetailsApi extends BaseApi {
    private String session;
    private String userOrderId;
    private String storeId;
    private String flag;

    public OwneiInsDetailsApi(HttpOnNextListener listener, RxAppCompatActivity rxAppCompatActivity) {
        super(listener, rxAppCompatActivity);
        setCache(false);
        setCookieNetWorkTime(0);
        setMothed(UserHelper.getInstance().getUserAccount() + Constants.OWN_GETOWNERINS);//相当于缓存保存的Key
        setCookieNoNetWorkTime(0);//无网缓存0天
        setShowProgress(true);
    }

    public String getSession() {
        return session;
    }

    public void setSession(String session) {
        this.session = session;
    }

    public String getUserOrderId() {
        return userOrderId;
    }

    public void setUserOrderId(String userOrderId) {
        this.userOrderId = userOrderId;
    }

    public String getStoreId() {
        return storeId;
    }

    public void setStoreId(String storeId) {
        this.storeId = storeId;
    }

    public String getFlag() {
        return flag;
    }

    public void setFlag(String flag) {
        this.flag = flag;
    }

    @Override
    public Observable getObservable(Retrofit retrofit) {
        HttpPostService service = retrofit.create(HttpPostService.class);
        return service.getOwnerInsDetail(getSession(), getUserOrderId(), getStoreId(), getFlag());
    }
}
